﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
  <class name="EnetaMvc.Core.Domain.Forums.Forum,EnetaMvc.Core" table="forum">

    <id name="Id" column="forum_id" type="long">
      <generator class="identity"/>
    </id>

    <property name="Name" column="forum_name" type="string" />
    <property name="Description" column="description" type="string" />
    <property name="FeedburnerRssUrl" column="feedburner_rss_url" type="string" />

    <many-to-one name="Category" column="forum_category_id" class="EnetaMvc.Core.Domain.Forums.ForumCategory,EnetaMvc.Core" />

    <bag name="Moderators" table="forum_moderator" inverse="true" cascade="all">
      <key column="forum_id" />
      <many-to-many class="EnetaMvc.Core.Domain.Common.User,EnetaMvc.Core" column="user_id" />
    </bag>

    <bag name="Posts" table="forum_post" inverse="true" cascade="all">
      <key column="forum_id" />
      <one-to-many class="EnetaMvc.Core.Domain.Forums.ForumPost,EnetaMvc.Core" />
    </bag>
  </class>
</hibernate-mapping>